package com.hava.homework.repository;

import com.hava.homework.entity.UserBalance;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by yanfa on 2016/10/27.
 */
public interface UserBalanceMyBatisDao extends UserBalanceDaoInterface{

    @Update("UPDATE UserBalance SET balance=balance+#{param2} WHERE userId=#{param1} ")
    public void addMoney(Long userId,double count);

    @Update("UPDATE UserBalance SET balance=balance-#{param2} WHERE userId=#{param1} ")
    public void subMoney(Long userId,double count);

    @Select("SELECT * FROM UserBalance")
    public List<UserBalance> findAll();

}
